started, inv = false, []
DownstreamHook.add('bag_check', Proc.new {|cs|
  if cs.clean_colors =~ /The Bag of Aardwolf contains:/
    started = true
    cs
  elsif started
    if cs.clean_colors =~ Char.prompt
      DownstreamHook.remove('bag_check')
    elsif cs.clean_colors =~ /^(\s{4}|\(\s?\d+\)) (.+) \((\d+)\)$/
      lev = $3.to_i
      inv.insert(inv.index {|item| lev < item[1]} || inv.size, [cs.chomp, lev])
    end
    nil
  else
    cs
  end
})
$app.send_text('look in (361185)')
wait_while(3) {DownstreamHook.list.include?('bag_check')}
DownstreamHook.remove('bag_check')
inv.each {|item| echo item[0]}